.. This file was automatically converted from MediaWiki syntax. If some markup is wrong, looks weird or doesn't make sense, feel free to fix it. Please remove this comment once this file was manually checked and no "strange ReST" artifacts remain. .. _reading-the-html-tokens: Reading the HTML tokens ======================= As described in :ref:`advanced-object-tags`, you can write Python code to respond to any arbitrary tokens given in the element. The AppRunner provides several interfaces for this: - base.appRunner.tokens This is a the raw token data, as a list of (token, value) tuples. Each token in the element, or in a element within the element, will appear here, in the order they appear on the web page. You can traverse this list if you have a token that supports multiple values. However, for most token values, which only define one value each, it's probably easier to use one of the following: - base.appRunner.getToken() - base.appRunner.getTokenInt() - base.appRunner.getTokenFloat() - base.appRunner.getTokenBool() These define a simple accessor to query a value defined for a particular token. They all return None if the token is not defined. The first form, getToken(), is the simplest, and returns the string value exactly as it appears on the web page. getTokenInt(), getTokenFloat(), and getTokenBool() automatically coerce this value into an integer, floating-point number, and boolean value.